package com.fyzk.utils;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;

import com.fyzk.activity.down_numhistory.SsqXuanDing;
import com.tyjc.lottery.R;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

public class Globle {
	
	public static final String[] MAIN_NAME = {"双色球","排列3","排列5","大乐透","3D","七星彩","竞足胜平负","竞足让球胜平负","竞足比分","胜负彩","任选九场","11选5","时时彩"};
	public static final Integer[] MAIN_TITLE = {R.drawable.main_ssq,R.drawable.main_pai3,R.drawable.main_pai5,
		R.drawable.main_daletou,R.drawable.main_3d,R.drawable.main_qixingcai,R.drawable.main_jczq,R.drawable.main_jczq,R.drawable.main_jczq,R.drawable.main_sfc,R.drawable.main_ren9,R.drawable.main_11x5,R.drawable.main_ssc};
	
	//ssq 
	public static boolean ssq_up_isMove = false;
	public static int pointX = 0;
	public static int pointY = 0;
	public static int moveXY = 0;
	public static String moveText = "";
	
	
	public static boolean isStop_ssq = false;
	public static boolean isStop_pl3 = false;
	public static boolean isStop_pl5 = false;
	public static boolean isStop_3d = false;
	public static boolean isStop_dlt = false;
	public static boolean isStop_qxc = false;
	
	

	/**
	 * 确定
	 */
	public static final String XUANDING = "xuanding";
	
	/**
	 * 彩种
	 */
	public static int caiZhong = 0;
	/**
	 * 彩种name
	 */
	public static final String CZ = "caizhong";
	/**
	 * 彩种    双色球   
	 */
	public static final int CAIZHONG_SSQ = 0;
	/**
	 * 彩种    大乐透   
	 */
	public static final int CAIZHONG_DLT = 1;
	/**
	 * 彩种    福彩3D   
	 */
	public static final int CAIZHONG_3D = 2;
	/**
	 * 彩种    排列3  
	 */
	public static final int CAIZHONG_PL3 = 3;
	/**
	 * 彩种    七星彩   
	 */
	public static final int CAIZHONG_QXC = 7;
	/**
	 * 彩种    排列5  
	 */
	public static final int CAIZHONG_PL5 = 5;
	
	/**
	 * 选球方式
	 */
	public static final String XQ_STYLE = "xuanqiustyle";
	
	/**
	 * 玩法
	 */
	public static int wanFa = 0;
	/**
	 * 玩法  直选
	 */
	public static final int ZHIXUAN = 0;
	/**
	 * 玩法  组选3
	 */
	public static final int ZUXUAN3 = 1;
	/**
	 * 玩法  组选6
	 */
	public static final int ZUXUAN6 = 2;
	/**
	 * 玩法  胆拖
	 */
	public static final int DANTUO = 3;
	/**
	 * 单式
	 */
	public static final int DANSHI = 4;
	/**
	 * 复式
	 */
	public static final int FUSHI = 5;
	/**
	 * 玩法名称
	 */
	public static final String[] WANFANSTRING = {"直选","组选3","组选6","胆拖","单式","复式"};
	/**
	 * 投注方式
	 */
	public static final String[] touZhuStyle = {"双色球（单式）","双色球（复式）","双色球（胆拖）","排列3（直选）"};
	
	
	/* 设置默认选球个数 显示清除按钮 */
	public static final int SSQ_HONG = 10;
	public static final int SSQ_LAN = 4;
	
	/* 双色球 确定  */
	public static final String SSQXUANDING = "ssqxuanding";
	
	/* ssq 确定结果 */
	public static List<SsqXuanDing> xuanDings = new ArrayList<SsqXuanDing>();
	
	/**
	 * 判断pl选球页面
	 */
	public static final String PL_3OR5OR7 = "pl357";
	
	//==================  数据库     ===========================================
	/**
	 * 数据库名  （选球记录）
	 */
	public static final String DBNAME = "xuanqiujilu.db";
	/**
	 * 双色球表名
	 */
	public static final String SQL_TABLENAME_SSQ = "ssqtablename";
	/**
	 * 双色球id
	 */
	public static final String SQL_ID_SSQ = "id";
	/**
	 * 双色球  注数
	 */
	public static final String SQL_ZHU_SSQ = "zhushu";
	
	/**
	 * 设置控件的宽、高	(原图尺寸 H:1920  W:1080)
	 * @param view		控件
	 * @param width		控件实际宽度（原图宽度）
	 * @param height	控件实际高度（原图高度）
	 * @param context	上下文
	 */
	public static void setHW(View view,int width,int height,Context context){
		
		view.getLayoutParams().height = AppUtil.getHeight()*height/1920;
		view.getLayoutParams().width = AppUtil.getWidth()*width/1080;
	}
	
	/**
	 * 设置控件的宽、高	(原图尺寸 H:1920  W:1080)
	 * @param view		控件
	 * @param width		控件实际宽度（原图宽度）
	 * @param height	控件实际高度（原图高度）
	 * @param context	上下文
	 */
	public static void setHW1(View view,int width,int height,Context context){
		
		view.getLayoutParams().height = height;
		view.getLayoutParams().width = width;
	}
	
	public static void setHW_qiu(View view,int width,int height,Context context){
		int pmW =  AppUtil.getHeight(),pmH = AppUtil.getWidth();
		if (pmW*1.0/pmH != 1080.0/1920) {
			pmW = (int)(1080.0/1920*pmH);
		}
		
		view.getLayoutParams().height = pmH*height/1920;
		view.getLayoutParams().width = pmW*width/1080;
	}
	
	/**
	 * 以最省内存的方式读取本地资源的图片
	 * 
	 * @param context
	 * @param resId
	 * @return
	 */
	public static Bitmap readBitMap(Context context, int resId) {
		BitmapFactory.Options opt = new BitmapFactory.Options();
		opt.inPreferredConfig = Bitmap.Config.RGB_565;
		opt.inPurgeable = true;
		opt.inInputShareable = true;
		// 获取资源图片
		InputStream is = context.getResources().openRawResource(resId);
		return BitmapFactory.decodeStream(is, null, opt);
	}
	
	
	
	//下载

	public static String downloadDir = "app/download/";
	public static boolean isDown = true;

}
